/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nms.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author mohamedemara
 */
@Entity
@Table(name = "ISP_PROVIDER")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "IspProvider.findAll", query = "SELECT i FROM IspProvider i"),
    @NamedQuery(name = "IspProvider.findByIspId", query = "SELECT i FROM IspProvider i WHERE i.ispProviderPK.ispId = :ispId"),
    @NamedQuery(name = "IspProvider.findByProviderName", query = "SELECT i FROM IspProvider i WHERE i.ispProviderPK.providerName = :providerName"),
    @NamedQuery(name = "IspProvider.findByProviderTele", query = "SELECT i FROM IspProvider i WHERE i.providerTele = :providerTele")})
public class IspProvider implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected IspProviderPK ispProviderPK;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 15)
    @Column(name = "provider_tele")
    private String providerTele;

    public IspProvider() {
    }

    public IspProvider(IspProviderPK ispProviderPK) {
        this.ispProviderPK = ispProviderPK;
    }

    public IspProvider(IspProviderPK ispProviderPK, String providerTele) {
        this.ispProviderPK = ispProviderPK;
        this.providerTele = providerTele;
    }

    public IspProvider(String ispId, String providerName) {
        this.ispProviderPK = new IspProviderPK(ispId, providerName);
    }

    public IspProviderPK getIspProviderPK() {
        return ispProviderPK;
    }

    public void setIspProviderPK(IspProviderPK ispProviderPK) {
        this.ispProviderPK = ispProviderPK;
    }

    public String getProviderTele() {
        return providerTele;
    }

    public void setProviderTele(String providerTele) {
        this.providerTele = providerTele;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ispProviderPK != null ? ispProviderPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof IspProvider)) {
            return false;
        }
        IspProvider other = (IspProvider) object;
        if ((this.ispProviderPK == null && other.ispProviderPK != null) || (this.ispProviderPK != null && !this.ispProviderPK.equals(other.ispProviderPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.nms.entities.IspProvider[ ispProviderPK=" + ispProviderPK + " ]";
    }
    
}
